package com.fengplus.demo.controller;

import com.fengplus.demo.service.HystrixService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hystrix")
public class HystrixController {

    @Autowired
    private HystrixService hystrixService;

    @GetMapping("/ok")
    public String InfoOk() {
        return hystrixService.infoOk();
    }

    @GetMapping("/error")
    public String InfoError() {
        return hystrixService.infoError();
    }

    @GetMapping("/timeout")
    public String InfoTimeout() {
        return hystrixService.infoTimeout();
    }

    @GetMapping("/global")
    public String InfoGlobal() {
        return hystrixService.infoGlobal();
    }

    @GetMapping("/feign")
    public String InfoFeign() {
        return hystrixService.infoFeign();
    }

    @GetMapping("/breaker/{id}")
    public String InfoBreaker(@PathVariable Long id) {
        return hystrixService.infoBreaker(id);
    }

}
